package rank1400;

/**
 * 2734. 执行子串操作后的字典序最小字符串
 */
public class No2734 {
    public String smallestString(String s) {
        char[] charArray = s.toCharArray();
        boolean flag = false;
        for (int i = 0; i < s.length(); i++) {
            if (charArray[i] != 'a') {
                charArray[i]--;
                flag = true;
            } else if (flag) break;
        }
        if (!flag) charArray[s.length() - 1] = 'z';
        return new String(charArray);
    }
}
